package com.crm.report.service.impl;


import com.crm.custinfo.domain.CustCommentRecord;
import com.crm.custinfo.mapper.CustCommentRecordMapper;
import com.crm.report.service.ICustCommentStaticsService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 客户备注统计
 *
 * @author Mr.Wen
 * @date 2024-02-25
 */
@Service
public class CustCommentStaticsServiceImpl implements ICustCommentStaticsService {

    @Autowired
    private CustCommentRecordMapper custCommentRecordMapper;

    /**
     * 客户备注统计
     * 20240304:新增功能 --
     * @param record
     * @return
     */
    @Override
    public List<Map<String, Object>> custCommentRecordStatics(CustCommentRecord record) {
        Map<String, Object> inParams = record.getParams();
        int queryType= MapUtils.getIntValue(inParams, "queryType");
        if(queryType==2) {
            //分公司
            return custCommentRecordMapper.custCommentRecordOrgL1Statics(record);
        }
        if(queryType==3) {
            //分区
            return custCommentRecordMapper.custCommentRecordOrgL2Statics(record);
        }
        if(queryType==4) {
            //部门
            return custCommentRecordMapper.custCommentRecordOrgL3Statics(record);
        }
        if(queryType==6) {
            //个人
            return custCommentRecordMapper.custCommentRecordEmpStatics(record);
        }
        return null;
    }
}
